package StudyCode.summary.mycollection;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CreatingATypeSpecificMap {
	public static void main(String[] argv) throws Exception {
		Map<Integer, String> map = new HashMap<Integer, String>();

		map.put(1, "first");
		map.put(2, "second");
		Map<Number, String> numMap = new HashMap<Number, String>();

		numMap.put(.5, "half");
		numMap.put(1, "first");
		map.put(null, null);
		Map<String, URL> urlMap = new HashMap<String, URL>();
		try {
			urlMap.put("java", new URL("http://www.tah1986.com"));
		} catch (MalformedURLException e) {
		}
		String s = urlMap.get("java").getHost();
		System.out.println(s);
	}
}
